package command.actions;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import command.Command;

public class Logout implements Command {

	@Override
	public String execute(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		System.out.println("command:" + this.getClass());
		// TODO Auto-generated method stub
		HttpSession session = request.getSession(false);
		if (session != null) {
			//pour affichage du login lors du goodbye
			request.setAttribute("login", session.getAttribute("login"));
			session.invalidate();
		}
		
		return ("/logout.jsp");
	}

}
